UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IwWM8O5A98+/SUDDD3UDPLglHAizApBWJs8NdB8Iz+Y='
WHERE
key_id = '8aef250b3f9ad993ff6b999a15cef1bac65001ed6b8c9461bc1994888c9d2637'
AND (
token = 'IwWM8O5A98+/SUDDD3UDPLglHAizApBWJs8NdB8Iz+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)