UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CKlnmKDBdpkuixX4ggKJr3/enlntm4lHe+K+d/H6Pbg=' 
WHERE 
  key_id = 'dfbec8d207da45bed28ab4af2326960a113230d9d0a4c3243ce2791e95770951' 
  AND (
    token = 'CKlnmKDBdpkuixX4ggKJr3/enlntm4lHe+K+d/H6Pbg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048