UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ygp0TzcqeSu1nnhykXtfRq2aeORKQVglESO4D3oyf44=' 
WHERE 
  key_id = '326761a12314fab7e379a72ce7740305b26608f68ac960459f0c76e7247ea649' 
  AND (
    token = 'Ygp0TzcqeSu1nnhykXtfRq2aeORKQVglESO4D3oyf44=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040