UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Msp5wco5c0/DxK1j3P2x0q+FgDt5oP6WYAY8AkXV8p8='
WHERE
key_id = 'b7f4fc3d459144e8c0d8402f918750040c912ca5ca94db54d7cb8982f10e94ec'
AND (
token = 'Msp5wco5c0/DxK1j3P2x0q+FgDt5oP6WYAY8AkXV8p8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)