UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'z82OdHSmc4M4EXnDOoKzm4xzXOOa3i1nggowc8wI1Bs='
WHERE
key_id = '6c577fcd20d029adbf514904ea8f063da57ba781240f12c9e7847711e41e82a2'
AND (
token = 'z82OdHSmc4M4EXnDOoKzm4xzXOOa3i1nggowc8wI1Bs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)