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