UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dX9jMNZ0pTvZXsKRSDn9t5xBF8LeXcaBVqpKz5+QK60='
WHERE
key_id = 'ac1c63ee8779e978d76e7d42654c6325cc17482d24a5a5125c38016dba39212e'
AND (
token = 'dX9jMNZ0pTvZXsKRSDn9t5xBF8LeXcaBVqpKz5+QK60='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)