UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't3dTksE/qkNROsBBIlTupouwtA98x35zxAAk2zNoxlo=' 
WHERE 
  key_id = 'ea3dd7897cc976553b2649c3f59206acabe9425ad396412277769943c75e9e23' 
  AND (
    token = 't3dTksE/qkNROsBBIlTupouwtA98x35zxAAk2zNoxlo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039