UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xw2H12ShGXg0R5hYpbQoM16Gaxtj16nWqLmZd5QPKq4='
WHERE
key_id = '8d2e2e8425e411e3f3b088e402189df5de1efebcda95338a95d451e5af727a8f'
AND (
token = 'xw2H12ShGXg0R5hYpbQoM16Gaxtj16nWqLmZd5QPKq4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)