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