UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4PDXWB96XjiNGIGzvrcZFMhsLta9OjvYuTkQYJpIB1w='
WHERE
key_id = 'a1f01383f6cee74ab0dd3f3e33ce881d04c1d130163c8beff588e3caf77b16ab'
AND (
token = '4PDXWB96XjiNGIGzvrcZFMhsLta9OjvYuTkQYJpIB1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)