UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M5S7SU5+ohPhBdQCkAxv9CstV1J+TytjA3VUr5r+BVI='
WHERE
key_id = '535273c8a6555c646817dbcbfe6515442cc91e2982acdba12bafeb547beda74b'
AND (
token = 'M5S7SU5+ohPhBdQCkAxv9CstV1J+TytjA3VUr5r+BVI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)