UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2KKPtrzwad9aYnkQq10fZ90GYCQuXijUlKSV4QBAEFk='
WHERE
key_id = 'ad9a244cf7df0abfaa12da2202d0e8dc713cdb611c192346f354bb284a1e0ef7'
AND (
token = '2KKPtrzwad9aYnkQq10fZ90GYCQuXijUlKSV4QBAEFk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)