UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P7qC6bqDmfPL4ZV2cEq1tTt9fvFftMkkglMXnJn2r9o=' 
WHERE 
  key_id = 'fb9beb84d1d228d2d25d65bfbf0fb1d9f0f6f3399a9e99153bce73b2958a3e3d' 
  AND (
    token = 'P7qC6bqDmfPL4ZV2cEq1tTt9fvFftMkkglMXnJn2r9o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043