UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3X9wTZKzNiXpLQj0J5mjOXJ02W4ZeR98WA2gIGUH3CQ='
WHERE
key_id = 'cb165228182f62f6ee4baea34b965c56177b9befbd7fa4eb920365584f9cb042'
AND (
token = '3X9wTZKzNiXpLQj0J5mjOXJ02W4ZeR98WA2gIGUH3CQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)