UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nW/F5pm3PB0nQUlc3YRM2KBZEZD//9PEHZX7N118Yy8='
WHERE
key_id = 'f8711b0ff99147b7bbd2150ce13f5f5403293757ff796c197a8054bcc830d12b'
AND (
token = 'nW/F5pm3PB0nQUlc3YRM2KBZEZD//9PEHZX7N118Yy8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)