UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J5nkoqUTXbunZmLGRG7RX9h8yes6krRPiARuOAx0Cpk='
WHERE
key_id = '78ac1d908201d9e751b8d13caa2e79d27b697f4e8a227d79495dfc3e49a8bf4f'
AND (
token = 'J5nkoqUTXbunZmLGRG7RX9h8yes6krRPiARuOAx0Cpk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)