UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iiobsb4rOGOMW7A4z0o8zTp8i3Y0MPUtEYrnphA7aow=' 
WHERE 
  key_id = 'ca1a9e9c77c8bbd4c1c91ffa918246f443844c4f0d47671f946902262e683131' 
  AND (
    token = 'Iiobsb4rOGOMW7A4z0o8zTp8i3Y0MPUtEYrnphA7aow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063