UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gxdIuYQx94e4BV0h8PwO7W3RFTNrg28eObVtEZ2R0js='
WHERE
key_id = '7732fd80022b295a289e4b4be5f80a3e0de44c809e1aa99037ef9f66fcad9a01'
AND (
token = 'gxdIuYQx94e4BV0h8PwO7W3RFTNrg28eObVtEZ2R0js='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)