UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8iaEtMfWsD/RdMMzMMLHbviNqGOG+cQXlkZslOwL9Mk=' 
WHERE 
  key_id = '44550b5e2610c2603cd0e8d44446381284efeaff1eb9167f32600596e0d3e466' 
  AND (
    token = '8iaEtMfWsD/RdMMzMMLHbviNqGOG+cQXlkZslOwL9Mk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026