UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZIoKKiOTduYvC6/6wbYf5uD38ZT8kT5t7uhUTXUn1t8='
WHERE
key_id = '2505c5fc63313cdf325c56e5c4a11499b0b6fd0494804b3b5f691db3e1ac32cd'
AND (
token = 'ZIoKKiOTduYvC6/6wbYf5uD38ZT8kT5t7uhUTXUn1t8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)