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