UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H6V5Cpe6GrTogw+rnHIPITvrB/d6khMH+Sgjif4Ep/g=' 
WHERE 
  key_id = '596e47ed4dcb2da95f07d8ed7cfc302dfaff2143454579298e6894ba0a27870e' 
  AND (
    token = 'H6V5Cpe6GrTogw+rnHIPITvrB/d6khMH+Sgjif4Ep/g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00125