UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RWr2FUFLfzQbYmtZbYjbYfqS8Pq8aSOOyD1UAaUkMo4='
WHERE
key_id = '30a9b97a25624ae3aed3cf3794115e66404458caf860e7ebc97bb2f785f04eb2'
AND (
token = 'RWr2FUFLfzQbYmtZbYjbYfqS8Pq8aSOOyD1UAaUkMo4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)