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