UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N/DDUVyyxhd8t3rr7Xnno4WENOgKQ/6FGh8rHiDRv7Q=' 
WHERE 
  key_id = 'd26f268c3f12aea54277527461b8e2272feb39a6781168e24387e80ac43359d2' 
  AND (
    token = 'N/DDUVyyxhd8t3rr7Xnno4WENOgKQ/6FGh8rHiDRv7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065