UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cT6osvrSOUDMiJ+NnjhMI5V8GZHUb1Q7oCgpWafcNjs='
WHERE
key_id = 'c583584c75018f78d79017aafa97f40d10f637bffd32033dae0ac565e0992c72'
AND (
token = 'cT6osvrSOUDMiJ+NnjhMI5V8GZHUb1Q7oCgpWafcNjs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)